﻿<%@ Page Language="C#" AutoEventWireup="true" CodeBehind="AddHrStudentInfo.aspx.cs" Inherits="ZX.WebApp.Crm.Deliver.AddHrStudentInfo" %>

<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">

<html xmlns="http://www.w3.org/1999/xhtml">
<head runat="server">
    <title></title>
    <script type="text/javascript" src="../../Scripts/yui_2.9.0/build/yahoo-dom-event/yahoo-dom-event.js"></script>
    <script type="text/javascript" src="../../Scripts/yui_2.9.0/build/connection/connection-min.js"></script>
    <script src="../../Scripts/jquery-1.6.min.js" type="text/javascript"></script>
    <script src="../../Scripts/jquery.json-2.2.min.js" type="text/javascript"></script>
    <script src="../../Scripts/jquery.calendar.js" type="text/javascript"></script>
    <script src="../../Scripts/Jquery.form.js" type="text/javascript"></script>
    <link href="../../Styles/default/calendar.css" rel="stylesheet" type="text/css" />
    <link href="../../Styles/extendTable.css" rel="stylesheet" type="text/css" />
</head>
<body>
    <form id="form1" runat="server">
    <div>
     <table class="tableContent" id="DutyInfoTable">
            <tr>
                <td style="height:30px; width:100px;">
                   <span style="color: Red">*</span>学员状态
                </td>
                <td>
                    <asp:DropDownList ID="GroupNumber" runat="server" Width="140">
                            <asp:ListItem Value="0">学习中</asp:ListItem>
                            <asp:ListItem Value="1">合格毕业</asp:ListItem>
                            <asp:ListItem Value="2">优秀毕业</asp:ListItem>
                            <asp:ListItem Value="3">不合格未毕业</asp:ListItem>
                            <asp:ListItem Value="4">转期</asp:ListItem>
                            <asp:ListItem Value="5">退学</asp:ListItem>
                        </asp:DropDownList>
                </td>
            </tr>
            <tr>
                <td style="height:30px;">
                   <span style="color: Red">*</span>结业日期
                </td>
                <td>
                   <input type="text" id="SignIn" runat="server" style="width: 150px;" />
                </td>
            </tr>
          
            <tr>
                <td style="height:30px;">
                    &nbsp;备注</td>
                <td>
                    <asp:TextBox ID="Explain" name="Explain" runat="server" 
                             MaxLength="100" TextMode="MultiLine" Width="250" Height="60"></asp:TextBox>
                </td>
            </tr>
        </table>
        <table class="tableContent" id="tbClass">
            <tr>
                <td style="height:30px; width:100px;">
                   <span style="color: Red">*</span>班级
                </td>
                <td>
                    <asp:DropDownList ID="ddlClass" runat="server"  AppendDataBoundItems="true">
                    <asp:ListItem Value="">--请选择--</asp:ListItem>
                    </asp:DropDownList>
                </td>
            </tr>
            <tr style="display:none">
                <td style="height:30px;">
                    &nbsp;班主任</td>
                <td>
                    <asp:TextBox ID="txtPTeacher" runat="server" 
                            Enabled="true" Width="150" ></asp:TextBox>
                </td>
            </tr>
            <tr style="display:none">
                <td style="height:30px;">
                    &nbsp;手机号</td>
                <td>
                    <asp:TextBox ID="txtTel" runat="server" 
                            Enabled="true" Width="150"></asp:TextBox>
                </td>
            </tr>
        </table>
    </div>
    </form>
</body>
<script type="text/javascript">
    var Entity = "CrmMajorStudentHr", StrId = "<%=StrId %>", StrClassId = "<%=StrClassId %>",
        Url = "";
    function Save() {
        if (StrClassId == "") {
            if (StrId != "") {
                var vStates = $("#GroupNumber").val();
                var vEndTime = $("#SignIn").val();
                if (vStates == "0") {
                    //alert("状态不能为学习中!");
                    //$("#GroupNumber").focus();
                    //return;
                } else if (vEndTime == "") {
                    alert("结业日期不能为空!");
                    $("#SignIn").focus();
                    return;
                } else {
                    Url = "../../EditWidows/OrganizationalManager/DataProcessin.aspx?entity=" + Entity + "&ID=" + StrId + "&action=Update&GraduateDate=" + vEndTime + "&Review=" + encodeURI($("#Explain").val()) + "&StudentState=" + vStates;
                    SaveData();
                } 
            }
        } else {
            if ($("#ddlClass").val() == "") {
                alert("班级不能为空!");
                $("#ddlClass").focus();
                return;
            }
            Url = "../../EditWidows/OrganizationalManager/DataProcessin.aspx?entity=" + Entity + "&StrClassId=" + StrClassId + "&ClassId=" + $("#ddlClass").val() + "&action=Update";
            SaveData();
        }
    }
    function SaveData() {
        YAHOO.util.Connect.asyncRequest('POST', Url, {
            success: function (res) {
                var inventory;
                try {
                    inventory = res.responseText;
                    if (inventory == 1) {
                        alert("保存成功!");
                        parent.BindData();
                        parent.closeWin();
                        
                    } else {
                        alert(inventory);
                    }
                }
                catch (e) {
                }
                finally {
                }
            },
            failure: function (error) {
                alert("数据错误：" + error.statusText);
            }
        }, null);
    }
    $('#ddlClass').change(function () {
        //alert("1");
    });
    $(document).ready(function () {
        $('#SignIn').cld();
        if (StrId == "")
            document.getElementById("DutyInfoTable").style.display = "none";
        if (StrClassId == "") {
            document.getElementById("tbClass").style.display = "none";
        }
    });
</script>
</html>
